﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace NewsWcfWebService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class ServiceNewsInfo : IServiceNewsInfo
    {
        public void printException(Exception ex)
        {
            Console.WriteLine("\nMessage ---\n{0}", ex.Message);
            Console.WriteLine(
                "\nHelpLink ---\n{0}", ex.HelpLink);
            Console.WriteLine("\nSource ---\n{0}", ex.Source);
            Console.WriteLine(
                "\nStackTrace ---\n{0}", ex.StackTrace);
            Console.WriteLine(
                "\nTargetSite ---\n{0}", ex.TargetSite);
        }


        public List<ItemNewsInfo> getInfoList()
        {
            try
            {
                //ServiceFactory service = new ServiceFactory();
                //service.getDataFromBaoTuoiTre();
                return tuoitreGetInfo.getCatelogesMenu();
            }
            catch (Exception ex)
            {
                printException(ex);
                return new List<ItemNewsInfo>();
            }
        }
    }
}
